/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ntweets.services;

import net.oauth.OAuthAccessor;
import net.oauth.OAuthConsumer;
import net.oauth.OAuthServiceProvider;

/**
 *
 * @author olawale
 */
public class InitAccessor {

    public InitAccessor(){
        callbackURL = "";
        consumerKey = "";
        consumerSecret = "";
        requestTokenURL = "";
        userAuthorizationURL = "";
        accessTokenURL = "";

        service = new OAuthServiceProvider(requestTokenURL, userAuthorizationURL, accessTokenURL);
        consumer = new OAuthConsumer(callbackURL, consumerKey, consumerSecret, service);
        accessor = new OAuthAccessor(consumer);

        accessor.accessToken = "";
        accessor.tokenSecret = "";
    }

    private final String callbackURL;
    private final String consumerKey;
    private final String consumerSecret;

    private final String requestTokenURL;
    private final String userAuthorizationURL;
    private final String accessTokenURL;

    private OAuthServiceProvider service;
    private OAuthConsumer consumer;
    private OAuthAccessor accessor;

    public static InitAccessor initAccessor;

    public static OAuthAccessor getAccessor(){
        if(initAccessor == null){
            initAccessor = new InitAccessor();
        }
        return initAccessor.accessor;
    }
}
